Add hash method to metadata to speed up comparing it in a hash key #2560
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Which issue(s) this PR fixes:
no
What this PR does / why we need it:
Object#hash is called when using an object as the hash key or reference value from a hash object with the object.
Current
Struct
's implementation is comparing all inner variables.https://github.com/ruby/ruby/blob/0623e2b7cc621b1733a760b72af246b06c30cf96/struct.c#L1200-L1203
This impl is a bit redundant. Especially in fluentd, it can be overhead.
e.g. Output#handle_stream_simple creates a hash object using an object as a key. this method is called per
emit
(one of the most called methods in fluentd).benchmark
Docs Changes:
no need
Release Note:
same as title